package com.dell.chen.service.Impl;

import com.dell.chen.dao.AdminDao;
import com.dell.chen.dao.impl.AdminDaoImpl;
import com.dell.chen.pojo.Admin;
import com.dell.chen.service.AdminService;

/**
 * @author ：ChenwithIU
 * @date ：Created in 2020/11/28 9:56
 */
public class AdminServiceImpl implements AdminService {

    private AdminDao adminDao = new AdminDaoImpl();

    @Override
    public Admin login(Admin admin) {
        return adminDao.queryByUsernameAndPassword(admin.getUsername(),admin.getPassword());
    }

    /**
     * 修改管理员密码
     * @param newPassword 新密码
     * @param password 旧密码
     * @return 返回1，修改成功
     */
    @Override
    public int update(String newPassword, String password) {
        return adminDao.updatePassword(newPassword,password);
    }


}
